package org.jason.mapmaker.server.service;

import org.jason.mapmaker.model.Border;
import org.jason.mapmaker.server.repository.BorderRepository;
import org.jason.mapmaker.shared.exceptions.ServiceException;
import org.jason.mapmaker.shared.exceptions.RepositoryException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Jason Ferguson
 */
public class BorderServiceImpl implements BorderService {

    private BorderRepository borderRepository;

    @Autowired
    public void setBorderRepository(BorderRepository borderRepository) {
        this.borderRepository = borderRepository;
    }

    public void persist(Border object) throws ServiceException {

        try {
            borderRepository.persist(object);
        } catch (RepositoryException ex) {
            throw new ServiceException(ex);
        }

    }

    public void remove(Border object) throws ServiceException {

        try {
            borderRepository.remove(object);
        } catch (RepositoryException ex) {
            throw new ServiceException(ex);
        }
    }
}
